Expand description
Tectonic is a complete TeX/LaTeX engine converted into a standalone library. It is derived from the XeTeX variant of TeX and uses the support files packages by the TeX Live project. Tectonic would not be possible without the hard work that has gone into these projects.
Because Tectonic is based on the XeTeX engine, it can take advantage of the features of modern fonts (TrueType, OpenType, etc.), outputs directly to the PDF file format, and supports Unicode inputs. Most importantly, the TeX experience delivered by Tectonic is completely embeddable: if you link with this crate you can fully process TeX documents, from source to PDF, without relying on any externally installed software, configuration, or resource files. This is possible because Tectonic bundles the traditional TeX tools and routes their I/O through a pluggable backend system.
This crate delivers command-line frontend, tectonic
, that has a modernized
user experience that hides TeX’s copious output (by default) and never asks
for user input. Virtually all of the functionality of the frontend is
accessible programmatically through the driver
module of this crate.
This crate joins a set of sub-crates that combine to provide the Tectonic user experience. Those crates generally have APIs that are more carefully structured and better documented than this crate, which grew somewhat organically. The foundational crates are:
tectonic_errors
for core error handing types.tectonic_status_base
for a basic user-facing status-reporting framework.tectonic_io_base
for the I/O abstraction framework.tectonic_bridge_core
for a framework to launch unsafe (C/C++) “engines” through FFI.
Building on these and other support crates of less general interest are the following major pieces of Tectonic’s functionality:
tectonic_bundles
for the“bundles” of TeX support files underlying Tectonic processing.tectonic_docmodel
for the Tectonic “document model” expressed inTectonic.toml
files.tectonic_engine_xetex
for the XeTeX engine.tectonic_engine_xdvipdfmx
for thexdvipdfmx
engine.tectonic_engine_bibtex
for the BibTeX engine.
The main module of this crate provides an all-in-wonder function for compiling LaTeX code to a PDF:
use tectonic;
let latex = r#"
\documentclass{article}
\begin{document}
Hello, world!
\end{document}
"#;
let pdf_data: Vec<u8> = tectonic::latex_to_pdf(latex).expect("processing failed");
println!("Output PDF size is {} bytes", pdf_data.len());
The driver
module provides a high-level interface for driving the
engines in more realistic circumstances.
Re-exports
pub use crate::engines::bibtex::BibtexEngine;
pub use crate::errors::Error;
pub use crate::errors::ErrorKind;
pub use crate::errors::Result;
Modules
tectonic_io_base::digest
types.Macros
try!
, but with the ability to add context to the error message.Error
of kind
errors::ErrorKind::Msg
.Structs
xdvipdfmx
engine.